<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>ATM自助服务系统首页</title>
    <link href="style/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
    	body{
    		padding:70px;
    	}
    </style>
  </head>
  
  <body>
  	<%
  		String error = request.getParameter("error");
  		if("100".equals(error)){
  	%>
  	<div style="color:red">用户名或密码错误！</div>
  	
  	<%}else if("10001".equals(error)){ %>
  		
  	<div style="color:red">请登录！</div>
  	<%}else if("400".equals(error)){ %>
  	<div style="color:red">账号已被冻结，请联系所在银行！</div>
  	<%} %>
  	<div class="topbar" data-dropdown="dropdown">
		<div class="topbar-inner">
			<div class="container">
				<h3>
					<a href="#">ATM系统登录</a>
				</h3>
			</div>
		</div>
	</div>
  	<form id="loginForm" action="user.jspx?task=login" method="post">
	  	<div class="actions">
	  			用户名:<input type="text" class="text" name="username"/>
	  	</div>
	  	
	  	<div class="actions">
	  		密码:<input type="password" class="text" name="password"/><br/>
	  	</div>
	  	<div class="actions">
	  		<input type="checkbox" value="reme" name="reme"/>记住我
	  	</div>	
  		<div class="actions">
  			<input id="loginBtn" class="btn large primary" type="button" value="登录"/>
  			<a class="btn success" href="user.jspx?task=add">赶快注册</a>
  		</div>
  		<div class="actions">
  			<a class="btn danger" href="admin.jspx?task=login">系统管理</a>
  		</div>
  		
  		
  	</form>	
  </body>
  
  <script type="text/javascript" src="script/jquery.js"></script>
  <script type="text/javascript">
  	$(document).ready(function(){
  		$("#loginBtn").click(function(){
  			var name = $("input[name='username']").val();
  			var pwd = $("input[name='password']").val();
  			if(name.trim().length == 0) {
  				$("input[name='username']").next("span").remove();
  				$("input[name='username']").after("<span style='color:red'>用户名不能为空</span>");
  				$("input[name='username']").focus();
  				return;
  			}
  			if(pwd.trim().length == 0) {
  				$("input[name='password']").next("span").remove();
  				$("input[name='password']").after("<span style='color:red'>密码不能为空</span>");
  				$("input[name='password']").focus();
  				return;
  			}
  			$("#loginForm").submit();
  		});
  		
  		$(".text").click(function(){
  			$(this).next("span").remove();
  		});
  	});
  	
  </script>
</html>
